import router from './router'
import store from '@/store'
// // 导入
// import NProgress from 'nprogress' // progress bar
// import 'nprogress/nprogress.css' // progress bar style
// import getPageTitle from '@/utils/get-page-title'
const wristList = ['/login', '/404']
router.beforeEach((to, from, next) => {
  const token = store.state.user.Token
  if (token) {
    if (to.path === '/login') {
      next('/')
    } else {
      store.dispatch('user/userInfo')
      next()
    }
  } else {
    if (wristList.includes(to.path)) {
      next()
    } else {
      next('/login')
    }
  }
})
